<template>
  <div class="newsinfo-container">
    <h1 class="title">{{newsinfolist.title}}</h1>
    <p class="newsinfo-nav">
      <span>发表时间：{{newsinfolist.add_time | dateFormat}}</span>
      <span>点击：{{newsinfolist.click}}</span>
    </p>
    <hr>
    <div class="content" v-html="newsinfolist.content">

    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      newsinfolist:{},
      id:this.$route.params.id
    }
  },
  created() {
    this.getNewsInfo()
  },
  methods: {
    getNewsInfo(){
      this.$http.get('news/show',{params:{id:this.id}}).then(result => {
        if(result.data.status === 0){
          this.newsinfolist = result.data.message[0];
        }else{
          this.$toast('加载失败')
        }
      })
    }
  },
}
</script>
<style lang="scss" scoped>
.newsinfo-container{
  padding: 0 5px;
  .title{
    font-size: 16px;
    margin: 10px 0;
    color: orangered;
  }
  .newsinfo-nav{
    display: flex;
    justify-content: space-between;
    color: #26a2ff;
  }
  .content{
    img{
      width: 100%;
    }
  }
}
</style>